package com.sjsu.cloudmanager.client.service;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.sjsu.cloudmanager.client.ui.model.CloudLabBean;
import com.sjsu.cloudmanager.client.ui.model.ComputingMachineBean;
import com.sjsu.cloudmanager.model.CloudLab;
import com.sjsu.cloudmanager.model.ComputingMachine;

import java.util.List;

/**
 * Cloud lab service interface used by GWT to make remote calls to service layer
 * User: ckempaiah
 * Date: 9/21/11
 * Time: 12:12 AM
 * To change this template use File | Settings | File Templates.
 */
@RemoteServiceRelativePath("gwt/cloudLabService")
public interface CloudLabService extends RemoteService {

    //START(CK, 10/7/2011) service methods returning model beans won't work on GWT remote calls

    /**
     * creates cloud lab
     *
     * @param labName
     * @param status
     * @return
     */
    public Integer createCloudLab(String labName, String status);

    /**
     * adds computing machine to cloud lab
     *
     * @param labId
     * @param machineName
     * @param operatingSystem
     * @param memory
     * @param osVersion
     * @return
     */
    public Integer addComputingMachine(Integer labId, String machineName, String operatingSystem, int memory, String osVersion);

    /**
     * adds machine software to cloud lab
     *
     * @param machineId
     * @param softwareIdList
     */
    public void addMachineSoftware(Integer machineId, List<Integer> softwareIdList);

    /**
     * gets computing machine
     *
     * @param machineId
     * @return
     */
    public ComputingMachine getComputingMachine(Integer machineId);

    /**
     * gets cloud lab
     *
     * @param labId
     * @return
     */
    public CloudLab getCloudLab(Integer labId);

    public void removeCloudLab(Integer cloudLabId);

    public void removeComputingMachine(Integer machineId);

    public List<ComputingMachine> findComputingMachines(Integer labId);

    public List<CloudLab> getCloudLabs();
    //END(CK, 10/7/2011) service methods returning model beans won't work on GWT remote calls

    /**
     * gets cloud lab bean list
     * @return
     */
    public List<CloudLabBean> getCloudLabBeanList();

    /**
     * get computing machine bean list
     * @return
     */
    public List<ComputingMachineBean> getComputingMachineBeanList();

    /**
     * save cloud lab
     * @param cloudLabBean
     */
    public void saveCloudLab(CloudLabBean cloudLabBean);

    /**
     * get computing machine bean
     *
      * @param machineId
     * @return
     */
    public ComputingMachineBean getComputingMachineBean(Integer machineId);

    /**
     * saves a computing machine bean
     * @param computingMachineBean
     */
    public void saveCloudResource(ComputingMachineBean computingMachineBean);

    /**
     * start cloud resource
     * @param computingMachineBeanList
     */
    public void startCloudResource(List<ComputingMachineBean> computingMachineBeanList);

    /**
     * stops a cloud resource
     * @param computingMachineBeanList
     */
    public void stopCloudResource(List<ComputingMachineBean> computingMachineBeanList);

    /**
     * terminates could resource
     * @param computingMachineBeanList
     */
    public void terminateCloudResource(List<ComputingMachineBean> computingMachineBeanList);

    /**
     * gets computing machine description including information from cloud vendor
     * @param machineId
     * @return
     */
    public ComputingMachineBean getComputingMachineDescription(Integer machineId);
}
